import {createRouter, createWebHistory,createWebHashHistory} from 'vue-router'

const router = createRouter({
    history:createWebHistory('h5'),  // 在访问路径前加上h5
    routes:[
        {
            path: '/',
            name: 'Index',
            meta:{
                title:'首页'
            },
            redirect:'/menu',
            component: () => import('@/views/index/index.vue')
        },
        {
            path: '/menu',
            name: 'Menus',
            meta:{
                title:'页面所有链接表',
                showLoading:0
            },
            component: () => import('@/views/menus/index.vue')
        },
        {
            path: '/login',
            name: 'Login',
            meta:{
                title:'登陆',
                showLoading:0
            },
            component: () => import('@/views/login/index.vue'),
            beforeEnter:async (to, from ,next)=>{
                if(from.name != "Policy"){ // 如果不是从使用协议返回的，清楚缓存
                    sessionStorage.removeItem('inputInfo')
                }
                next()
            }
        },
        {
            path: '/collection',
            name: 'Collection',
            meta:{
                title:'藏品'
            },
            component: () => import('@/views/collection/index.vue')
        },
        {
            path: '/gallery',
            name: 'Gallery',
            meta:{
                title:'艺术长廊'
            },
            component: () => import('@/views/gallery/index.vue')
        },
        {
            path: '/auction',
            name: 'Auction',
            meta:{
                title:'拍卖会'
            },
            component: () => import('@/views/auction/index.vue')
        },
        {
            path: '/artist',
            name: 'Artist',
            meta:{
                title:'艺术家'
            },
            component: () => import('@/views/artist/index.vue')
        },
        {
            path: '/artist/:id',
            name: 'ArtistHome',
            meta:{
                title:'艺术家主页'
            },
            component: () => import('@/views/artist/home.vue')
        },
        {
            path: '/landmark',
            name: 'Landmark',
            meta:{
                title:'AR地标'
            },
            component: () => import('@/views/landmark/index.vue')
        },
        {
            path: '/landmark/:id',
            name: 'LandmarkDetail',
            meta:{
                title:'AR地标详情'
            },
            component: () => import('@/views/landmark/detial.vue')
        },
        {
            path: '/meet',
            name: 'Meet',
            meta:{
                title:'艺术遇见AR'
            },
            component: () => import('@/views/landmark/meet.vue')
        },
        {
            path: '/detail/:id',
            name: 'Detail',
            meta:{
                title:'详情'
            },
            component: () => import('@/views/detail/index.vue')
        },
        {
            path: '/order/:id',
            name: 'Order',
            meta:{
                title:'立即购买'
            },
            component: () => import('@/views/order/index.vue')
        },
        {
            path: '/pay/success',
            name: 'PaySuccess',
            meta:{
                title:'支付结果',
                showLoading:0
            },
            component: () => import('@/views/order/pay/success.vue')
        },
        {
            path: '/pay/fail',
            name: 'PayFail',
            meta:{
                title:'支付结果',
                showLoading:0
            },
            component: () => import('@/views/order/pay/fail.vue')
        },
        {
            path: '/address',
            name: 'Address',
            meta:{
                title:'地址列表'
            },
            component: () => import('@/views/address/index.vue')
        },
        {
            path: '/address/add',
            name: 'AddAddress',
            meta:{
                title:'添加地址',
                showLoading:0
            },
            component: () => import('@/views/address/add.vue')
        },
        {
            path: '/redpacket',
            name: 'RedPacket',
            meta:{
                title:'红包'
            },
            component: () => import('@/views/redPacket/index.vue')
        },
        {
            path: '/home/integral',
            name: 'HomeIntegral',
            meta:{
                title:'我的积分'
            },
            component: () => import('@/views/home/integral/index.vue')
        },
        {
            path: '/home/message',
            name: 'HomeMessage',
            meta:{
                title:'消息中心'
            },
            component: () => import('@/views/home/message/index.vue')
        },
        {
            path: '/home/message/:id',
            name: 'HomeMessageDetail',
            meta:{
                title:'消息详情'
            },
            component: () => import('@/views/home/message/detail.vue')
        },
        {
            path: '/home/order',
            name: 'HomeOrder',
            meta:{
                title:'我的订单'
            },
            component: () => import('@/views/home/order/index.vue')
        },
        {
            path: '/home/order/:id',
            name: 'HomeDetail',
            meta:{
                title:'订单详情'
            },
            component: () => import('@/views/home/order/detail.vue')
        },
        {
            path: '/home/like',
            name: 'HomeLike',
            meta:{
                title:'我喜欢的'
            },
            component: () => import('@/views/home/like/index.vue')
        },
        {
            path: '/home/follow',
            name: 'HomeFollow',
            meta:{
                title:'我关注的'
            },
            component: () => import('@/views/home/follow/index.vue')
        },
        {
            path: '/home/aboutus',
            name: 'HomeAboutus',
            meta:{
                title:'关于我们',
                showLoading:0
            },
            component: () => import('@/views/home/aboutus/index.vue')
        },
        {
            path: '/home/edition',
            name: 'HomeEdition',
            meta:{
                title:'日志版本'
            },
            component: () => import('@/views/home/edition/index.vue')
        },
        {
            path: '/home/userInfo',
            name: 'HomeUserInfo',
            meta:{
                title:'个人信息'
            },
            component: () => import('@/views/home/userInfo/index.vue')
        },
        {
            path: '/home/auction',
            name: 'HomeAuction',
            meta:{
                title:'我参加的拍卖'
            },
            component: () => import('@/views/home/auction/index.vue')
        },
        {
            path: '/home/auction/:id', // 拍卖详情
            name: 'HomeAuctionDetail',
            meta:{
                title:'拍卖结果'
            },
            component: () => import('@/views/home/auction/detail.vue')
        },
        {
            path: '/policy/:id',
            name: 'Policy',
            meta:{
                title:'协议'
            },
            component: () => import('@/views/policy/index.vue')
        },
        {
            path: '/share/:type/:id',  // type： // 1为商品详情，2为拍卖详情，id：商品id
            name: 'Share',
            meta:{
                title:'分享'
            },
            component: () => import('@/views/share/index.vue')
        },
        {
            path: '/share/link',  //扫描二维码后打开的连接
            name: 'ShareLink',
            meta:{
                title:'元界'
            },
            component: () => import('@/views/share/qrcodeLink.vue')
        },
        {
            path: '/map',  //  加载百度地图
            name: 'Map',
            meta:{
                title:'百度地图'
            },
            component: () => import('@/views/landmark/map.vue')
        },
        {
            path: '/home/goods',
            name: 'HomeGoods',
            meta:{
                title:'我的藏品'
            },
            component: () => import('@/views/home/goods/index.vue')
        },
    ]
})

export default router